package com.dto;

import java.io.IOException;
import java.util.Properties;

/**
 * 主要用于存放各种提示信息
 * @author:LG
 * @date:Created at 2019/03/09
 */
//一个消息类 有两种成员变量一种是小写的可以改变的变量（读取properties文件），第二种是大小的不能改变的变量（提供给DTO）
public class Messages {
    private static String AllNewsSuccess= "";
    private static String AllNewsFail= "";
    private static String addNewsSuccess= "";
    private static String addNewsFail= "";
    private static String deleteNewsSuccess= "";
    private static String deleteNewsFail= "";
    private static String updateNewsSuccess= "";
    private static String updateNewsFail= "";
    private static String getNewsByPageSuccess= "";
    private static String getNewsByPageFail= "";
    private static String getNewsByIdWithAnosSuccess= "";
    private static String getNewsByIdWithAnosFail= "";
    private static String getNewsByIdWithAnoandmembersSuccess= "";
    private static String getNewsByIdWithAnoandmembersFail= "";
    
    //社团类型
    private static String getMembertypeSuccess= "";
    private static String getMembertypeFail= "";
    //社团
    private static String getALLMemberSuccess= "";
    private static String getALLMemberFail= "";
    //管理员
    private static String getAllAdminSuccess= "";
    private static String getAllAdminFail= "";



   static{
       Properties prop = new Properties();// 空的配置类
       try {
           prop.load(Messages.class.getResourceAsStream("/messages.properties"));// Object.class找到jvm运行的class文件所在的目录，
       } catch (IOException e) {
           e.printStackTrace();
       }
       // getResourceAsStream 以流的形式将文件读到内存，不写/ 根路径表示当前class所在的文件夹下面找文件 写
       // 根路径就是当前项目下面找文件 bin

       AllNewsSuccess = prop.get("AllNewsSuccess").toString();
       AllNewsFail = prop.get("AllNewsFail").toString();
       addNewsSuccess = prop.get("addNewsSuccess").toString();
       addNewsFail = prop.get("addNewsFail").toString();
       deleteNewsSuccess = prop.get("deleteNewsSuccess").toString();
       deleteNewsFail = prop.get("deleteNewsFail").toString();
       updateNewsSuccess = prop.get("updateNewsSuccess").toString();
       updateNewsFail = prop.get("updateNewsFail").toString();
       getNewsByPageSuccess = prop.get("getNewsByPageSuccess").toString();
       getNewsByPageFail = prop.get("getNewsByPageFail").toString();
       getNewsByIdWithAnosSuccess = prop.get("getNewsByIdWithAnosSuccess").toString();
       getNewsByIdWithAnosFail = prop.get("getNewsByIdWithAnosFail").toString();
       getNewsByIdWithAnoandmembersSuccess = prop.get("getNewsByIdWithAnoandmembersSuccess").toString();
       getNewsByIdWithAnoandmembersFail = prop.get("getNewsByIdWithAnoandmembersFail").toString();

       //社团类型
       getMembertypeSuccess = prop.get("getMembertypeSuccess").toString();
       getMembertypeFail = prop.get("getMembertypeFail").toString();

       //社团
       getALLMemberSuccess = prop.get("getAllMemberSuccess").toString();
       getALLMemberFail = prop.get("getAllMemberFail").toString();
       //管理员
       getAllAdminSuccess = prop.get("getAllAdminSuccess").toString();
       getAllAdminFail = prop.get("getAllAdminFail").toString();


   }
    /*学生模块操作信息*/
    public final static String ALLNEWSSUCCESS= AllNewsSuccess;
    public final static String ALLNEWSFAIL= AllNewsFail;
    public final static String ADDNEWSSUCCESS= addNewsSuccess;
    public final static String ADDNEWSFAIL= addNewsFail;
    public final static String DELETENEWSSUCCESS= deleteNewsSuccess;
    public final static String DELETENEWSFAIL= deleteNewsFail;
    public final static String UPDATENEWSSUCCESS= updateNewsSuccess;
    public final static String UPDATENEWSFAIL= updateNewsFail;
    public final static String GETNEWSBYPAGESUCCESS= getNewsByPageSuccess;
    public final static String GETNEWSBYPAGEFAIL= getNewsByPageFail;
    public final static String GETNEWBYIDWITHANOSSUCCESS= getNewsByIdWithAnosSuccess;
    public final static String GETNEWBYIDWITHANOFAIL= getNewsByIdWithAnosFail;
    public final static String GETNEWBYIDWITHANOANDMEMBERSSUCCESS= getNewsByIdWithAnoandmembersSuccess;
    public final static String GETNEWBYIDWITHANOANDMEMBERSFAIL= getNewsByIdWithAnoandmembersFail;


    //社团类型
    public final static String GETMEMBERTYPESUCCESS= getMembertypeSuccess;
    public final static String GETMEMBERTYPEFAIL= getMembertypeFail;
    //社团
    public final static String GETALLMEMBERSUCCESS= getALLMemberSuccess;
    public final static String GETALLMEMBERFAIL= getALLMemberFail;
    //管理员
    public final static String GETALLADMINSUCCESS= getAllAdminSuccess;
    public final static String GETALLADMINFAIL= getAllAdminFail;



    public static void main(String[] args) {
        System.out.println(Messages.ALLNEWSSUCCESS);
    }
}
